<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAttendancesTable extends Migration
{
    /**
     * Run the migrations.
     * 考勤记录表
     * @return void
     */
    public function up()
    {
        Schema::create('attendances', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('import_attendances_id')->index()->comment('考勤导入批次id');
            $table->string('staff_no', '16')->index()->comment('员工工号');
            $table->string('name', '16')->index()->comment('员工姓名');
            $table->string('department')->comment('所属部门');
            $table->integer('base_working_time')->comment('标准工作时数');
            $table->integer('actual_working_time')->comment('实际工作时数');
            $table->integer('skip')->comment('迟到次数');
            $table->integer('skip_grade')->comment('迟到分数');
            $table->integer('live_earl')->comment('早退次数');
            $table->integer('live_earl_grade')->comment('早退分数');
            $table->integer('base_exploited_times')->comment('正常加班时数');
            $table->integer('special_exploited_times')->comment('特殊加班时数');
            $table->string('base_actual_days')->comment('出勤天数(标准/实际)');
            $table->integer('travel_days')->comment('出差天数');
            $table->integer('skip_work_days')->comment('旷工天数');
            $table->integer('leave_days')->comment('请假天数');
            $table->string('work_rate', '20')->comment('工作比率');
            $table->string('salary_remark')->comment('工资标注');
            $table->integer('exploited_salary')->comment('加班工资');
            $table->integer('add_salary')->comment('津贴');
            $table->integer('late_reduce')->comment('迟到/早退');
            $table->integer('leave_reduce')->comment('事假');
            $table->integer('reduce_salary')->comment('扣款');
            $table->integer('actual_salary')->comment('实际工资');
            $table->string('remark')->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('attendances');
    }
}
